<template>
  <div class="container">
    <data-view
      propViewKey="base_supplier"
      propViewForm="base/supplier/detail.vue"
      :propShowToolBar="true"
      :propIsTdesign="true"
      @extra-button-click="extraButtonClick"
      ref="dv"
    />



    <!--数据导入-->
    <customDrawer title="供应商数据导入" ref="customDrawerImport"
                  :widthPx="500" :heightPx="500"
                  hideConfirm
    >
      <template #content>
        <dataImportArea
          downloadPath="/base/supplier/excelDownloadTemp"
          importPath="/base/supplier/excelImport"
          :sheetName="'供应商'"
          helpMsg="
          1、【下载模板】维护好数据 -> 【选择文件】导入数据<br>
          2、<span class='span-msg-nopad'>目前仅新增供应商</span><br>
          3、<span class='span-msg-nopad'>根据供应商名称判断是否存在</span>
"
          @success="menuActiveCall"
          ref="dataImportArea"
        />
      </template>
    </customDrawer>

    <!--批量设置属性-->
    <setBatchWin
      ref="setBatchWin"
      @afterSet="menuActiveCall"
      setType="供应商"
      setAction="base/supplier/setBatch"
    >
      <template #form>
        <customFormItem label="禁用" name="flagDisabled" :parent="_self" :form="$refs.setBatchWin.setForm"
                        :type="constCommon.formItemType.selectStatic.name"
                        :config="{options: constCommon.nobusConst.yesNoBoolean}"
                        full-width
        />
      </template>
    </setBatchWin>
  </div>
</template>

<script>
import dataImportArea from '@/components/custom/bus/dataImportArea.vue'
import setBatchWin from '@/components/custom/tool/setBatchWin.vue'

export default {
  name: 'supplier',
  data() {
    return {

    }
  },
  components: {
    setBatchWin,
    dataImportArea,
  },
  methods: {
    extraButtonClick(para) {
      let {key: buttonKey} = para.button
      if (buttonKey == 'push') { //推送供应商平台
        this.utils.runOnceByInvokeTarget('推送供应商到SCP', 'supplierToMscm', () => {
          this.$refs.dv.setQueryWrapper()
        })
      } else if (buttonKey === 'importDataCustom') { // 导入数据
        this.$refs.dataImportArea.clear()
        this.$refs.customDrawerImport.show()
      } else  if (buttonKey == 'setBatch') {
        this.$refs.setBatchWin.show(para.data)
      }
    },
    // 菜单激活触发
    menuActiveCall() {
      this.$refs.dv.fetchData()
    }
  }
}
</script>

<style lang="scss" scoped>
  .container {
    height: 100%;
    background-color: #fff;
  }
</style>
